package notify

import (
	"APT/internal/dao"
	"context"
	"database/sql"
	"errors"
	"strings"

	"APT/api/notify/kefu"
)

func (c *ControllerKefu) FindMemberInfo(ctx context.Context, req *kefu.FindMemberInfoReq) (res *kefu.FindMemberInfoRes, err error) {
	res = new(kefu.FindMemberInfoRes)
	if err = dao.PmsMember.Ctx(ctx).Where(dao.PmsMember.Columns().Id, req.Id).WithAll().Scan(&res); err != nil && !errors.Is(err, sql.ErrNoRows) {
		return
	}
	return
}
func (c *ControllerKefu) FindMemberInfos(ctx context.Context, req *kefu.FindMemberInfosReq) (res *kefu.FindMemberInfosRes, err error) {
	res = new(kefu.FindMemberInfosRes)
	if err = dao.PmsMember.Ctx(ctx).WherePri(strings.Split(req.Ids, ",")).WithAll().Scan(&res.List); err != nil && !errors.Is(err, sql.ErrNoRows) {
		return
	}
	return
}
